import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入路由
Vue.use(VueRouter)
// 1.导入组件
import ArtCate from '@/views/Article/ArtCate.vue'
import ArtList from '@/views/Article/ArtList.vue'
import Home from '@/views/Home/Home.vue'
import Login from '@/views/User/Login.vue'
import Main from '@/views/User/Main.vue'
import Register from '@/views/User/Register.vue'
import UserAvatar from '@/views/User/UserAvatar.vue'
import UserInfo from '@/views/User/UserInfo.vue'
import UserPwd from '@/views/User/UserPwd.vue'
//2.配置路由规则
const routes = [
  // 重定向
  {path : "/" , redirect : "/main"},
  // 一级路由
  { path: "/register", component: Register },
  { path: "/login", component: Login },
  { path: "/main", component: Main ,children:[
    // 二级路由
    { path: "/user-avatar", component: UserAvatar },
    { path: "/user-info", component: UserInfo },
    { path: "/user-pwd", component: UserPwd },
    { path: "/art-cate", component: ArtCate },
    { path: "/art-list", component: ArtList },
    { path: "/home", component: Home },
  ]},
]
// 3.创建路由对象router,管理路由规则router
const router = new VueRouter({
  routes
})
// 导出router对象
export default router
